<!DOCTYPE html>
<html>

<head>
    <script type="text/javascript" >
    </script>
</head>

<body>
    <div id="d">
        <p>Content</p>
        <p>Further Elaborated</p>
    </div>
    
    <button onclick="removeDiv()">删除第二个div</button>

    <script type="text/javascript">
        // xmlDoc = loadXMLDoc("/example/xdom/books.xml");

        // newel = xmlDoc.createElement("edition");

        // x = xmlDoc.getElementsByTagName("book")[0];
        // x.appendChild(newel);

        // document.write(x.getElementsByTagName("edition")[0].nodeName);



        // 删除节点
        function removeDiv() {
            const d = document.getElementById("d");
            console.log(d.outerHTML);
            d.outerHTML = "<p>This paragraph replaced the original div.</p>";
        }
    </script>
</body>

</html>